//
//  DestinationScenicCell.m
//  TravelToHelp
//
//  Created by lanou3g on 15/10/29.
//  Copyright © 2015年 冯贵宾. All rights reserved.
//

#import "DestinationScenicCell.h"

@interface DestinationScenicCell ()

@property (nonatomic, strong) UIImageView *photoView;
@property (nonatomic, strong) UILabel *titleLable;
@property (nonatomic, strong) UILabel *recommendLable;
@property (nonatomic, strong) UILabel *visitedCountLable;
@property (nonatomic, strong) UIImageView *nextImageView;

@end


@implementation DestinationScenicCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self addSubViews];
    }
    return self;
}

- (void)addSubViews
{
    self.photoView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 120, 120)];
    self.photoView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.photoView];
    
    self.titleLable = [[UILabel alloc] initWithFrame:CGRectMake(self.photoView.right + 10, self.photoView.top, kScreenWidth - self.photoView.right - 10, 35)];
    self.titleLable.font = [UIFont systemFontOfSize:23];
    [self.contentView addSubview:self.titleLable];
    
    self.recommendLable = [[UILabel alloc] initWithFrame:CGRectMake(self.titleLable.left, self.titleLable.bottom, self.titleLable.width, 45)];
    self.recommendLable.numberOfLines = 0;
    self.recommendLable.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:self.recommendLable];
    
    self.visitedCountLable = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - 100, self.recommendLable.bottom, 95, 30)];
    self.visitedCountLable.textAlignment = NSTextAlignmentRight;
    self.visitedCountLable.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:self.visitedCountLable];
    
    self.nextImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    
}

- (void)setModel:(DestinationScenicModel *)model
{
    [self.photoView sd_setImageWithURL:[NSURL URLWithString:model.cover_s] placeholderImage:[UIImage imageNamed:@"placeholderF.png"]];
    self.recommendLable.text = [NSString stringWithFormat:@"%@", model.recommended_reason];
    self.titleLable.text = [NSString stringWithFormat:@"%@", model.name];
    self.visitedCountLable.text = [NSString stringWithFormat:@"%@人去过", model.visited_count];
    [self.nextImageView sd_setImageWithURL:[NSURL URLWithString:model.cover] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
